﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using tactics.GUI.DialogBox;
using tactics.Interfaces;

namespace tactics.Commands
{
    class ShowGameOverDialogCommand : BaseCommand
    {
        okFunction accept;

        Player winner;

        public ShowGameOverDialogCommand(Player winnerIn)
        {
            winner = winnerIn;

            accept = new okFunction(Accept);

            Finished = false;

            CommandQueue.Instance.AddCommand(new EnableDisableMouseCommand(false));
        }

        public override void Execute()
        {
            String endText = "";

            if (winner != null)
                endText = winner.Name + " wins!";
            else
                endText = "Draw! Everyone is dead!";

            var dialog = new DialogBox("Game Over!", endText, "", 250, 120, false, accept, null);
        }

        private void Accept()
        {
            CommandQueue.Instance.AddCommand(new EnableDisableMouseCommand(true));
            TacticsEngine.Instance.QuitGame();
            Finished = true;
        }
    }
}
